package com.mo;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

import java.util.Map;


    @RestController
    @RequestMapping("/provider/template/")
    public class RestProviderController{
        @PostMapping
        public Map<String, Object> doPost(@RequestBody Map<String, Object> map) {
            System.out.println("consumer post data: " + map);
            map.put("status", 1);
            return map;
        }


        @Value("${server.port}")
        private String server;

        @DeleteMapping("{id}")
        public void doDelete(@PathVariable Integer id){
            System.out.println(id+" is delete by "+server);
           // throw  new RuntimeException("delete error");
        }


        @PutMapping()
        public void doPut(@RequestBody Map<String, Object> map) {
            System.out.println("consumer put data: " + map);
            //System.out.println("id value is"+id);

        }

    }
